MC-10 Operation and Language Reference Manual Chapter 6

6/RE-USABLE INSTRUCTIONS (Programs) The previous examples used instructions that were processed "immediately" by the MC-10. This method of operation is called the "Immediate Mode"; it describes any instruction that is performed "right now" and is not stored for future repetition. (The Immediate Mode, in other words, is a lot like money-it vanishes as quickly as it appears!) Most Micro Color BASIC keywords can be used from Immediate Mode. Use "commands" like PRINT when you want to tell the Computer to do something. Commands can be entered directly. Use "functions" on the other hand, when you want the Computer to tell you something. Functions can also be used in the Immediate Mode but they must be used in conjunction with a command such as PRINT. The MC-10 has much greater memory capabilities than it's exhibited so far. In fact, it can remember and re-use instructions. Re-usable instructions are called "programs". These are instructions you can use over and over without having to re-type the message. Line Numbers Actually the MC-10 doesn't remember the instruction itself. Instead, it remembers where that instruction is stored. This is somewhat like your not being able to remember every telephone number in the phone book. But you do know where to look if you want to find a specific person's phone number. A Computer is much the same. Instead of remembering an alphabetical sequence of letters, however, it remembers numbers. Each re-usable instruction must begin with a number called a "line number". A line number can be any decimal number between 0 and 63999. For instance: 1 A$ = "PROGRAM LINES" 100 PRINT A$ 63999 PRINT "THE END" are all valid program lines. if you try to enter a line like: 64110 print "the end" a Syntax Error will be displayed since 64110 is greater than the allowable line numbers. We suggest you use line numbers in increments of 10 if possible. You can number your program lines in increments of 1, but good programming practices dictate you should try to use increments of 10 (10, 20, 30, 40, etc.). This is convenient if you want to go back and add program lines in between existing lines (10, 15, 20, 30, etc.). The NEW Command Before writing any programs, you should always erase any current programs or data from the MC-10's memory. There are three ways to erase a program: Turn the Computer OFF. When you do so, all contents currently in memory will be erased. Type another program using the same line numbers. A new line 10 will replace an old line 10. Type in the Micro Color BASIC command NEW.
NEW
NEW simply tells the MC-10 that you want to erase the current contents of memory so you can write a "new" program. To do this, be sure the OK prompt is displayed and type: NEW [ENTER] The OK prompt will reappear. Now type LIST [ENTER]. When you do, nothing will be listed because memory has been erased. There Has To Be An Easier Way... One of the biggest features of the MC-10 is its small size. But the small keyboard is also sometimes difficult to type on. Consequently, we've assigned the most commonly used Micro Color BASIC commands and functions "control" keys. That means you press [CONTROL] and then the key directly under the command or statement. To save you the trouble of typing NEW over and over, just type: [CONTROL][5] Writing Your First Program Are you ready to write your first "computer program"? To do so, you'll need to use a line number. For example: 10 PRINT "THIS IS MY FIRST MC-10 PROGRAM" Don't press [ENTER] yet! Check the line for mistakes. If you found any, just press [CONTROL][A] to backspace the Cursor and make the correction. Then finish typing the line. Now press [ENTER]. Expand the program by adding another line to it: 20 PRINT "THIS IS THE SECOND LINE" [ENTER] The RUN Command Now that you've written a program, what do you do with it then? Well, you probably want the Computer to process it. The Micro Color BASIC RUN command will process or "run" the program.
RUN line number line number specifies the program line where execution is to begin. line number is optional; if omitted, the first line in the program is used.
Press RESET to clear the TV Screen. When the OK prompt is displayed, type: RUN [ENTER] and the TV will display: THIS IS MY FIRST MC-10 PROGRAM THIS IS THE SECOND LINE OK There, you've done it! You've written and run your first Micro Color BASIC program. In most cases, you'll want to begin running the programs at the beginning. If so, then use RUN the way you just did. However, if you ever want to run the program from a specified line, just type in the line number where program execution is to begin after the command. For instance, when you type: RUN 20 [ENTER] the Screen will display: THIS IS THE SECOND LINE OK There Has To Be An Easier Way... To save you the trouble of typing RUN over and over, just type: [CONTROL][1] and the word RUN will appear on the TV. You can then press [ENTER] and program execution will begin at the first line in the program, or specify a line number and press [ENTER] to begin program execution somewhere else in the program. The LIST Command Just because you've run the program, don't think it's gone away somewhere; it's still in the MC-10's memory-you just can't see it. (After all, we did call it a "re-usable instruction".) To see the program again, you'll need to "list" it on the TV Screen. Use the LIST command to do this.
LIST startline - endline startline is the first program line you want listed. startline is optional; if omitted, the first line in the program is used. endline is the last program line you want listed. endline is optional; if omitted, the last line in the program is used. If both startline and endline are omitted, the entire program will be listed.
This command will display the entire program that is currently in the MC-10 memory, or the lines in the program you specify. If you want the entire program displayed, type LIST [ENTER] and the program currently in the Computer's memory will be listed. If you want a single line displayed, type LIST followed by the line number and press [ENTER]. Only that line will be displayed. For example, LIST 50 [ENTER] will list line 50 only. If you want to display all lines from the beginning of the program to a specified line, type LIST -endline and press [ENTER]. For instance, LIST -100 will list all lines from the beginning of the program to and including line 100. If you want to display all lines from a specified line to the end of the program, type LIST startline- [ENTER]. For example, LIST 50- [ENTER] will display all program lines from line 50 to the end of the program. The last way to use LIST is to display specified lines within the program. LIST startline-endline [ENTER] will list all program lines within the specified range. For instance, LIST 50-75 [ENTER] will list all lines from 50 to 75. To list the program you previously entered, type: LIST [ENTER] and the TV should display: OK LIST 10 PRINT "THIS IS MY FIRST MC-10 PROGRAM" 20 PRINT "THIS IS THE SECOND LINE" OK Now list the program by typing: LIST 10 [ENTER] or LIST -20 [ENTER] or LIST 10-20 [ENTER] There Has To Be An Easier Way... To list the current program without typing the command LIST, press the key-combination of: [CONTROL][6] and the word LIST will appear on the TV. You can then use the command in any of the ways described above. The LLIST Command Do you have a printer connected to your MC-10? If you do, you can use the LLIST command to get a print-out on paper of the program.
LLIST startline - endline startline is the first program line you want listed. startline is optional; if omitted, the first line in the program is used. endline is the last program line you want listed. endline is optional; if omitted, the last line in the program is used. If both startline and endline are omitted, the entire program will be listed.
LLIST can be used exactly like LIST except the program is listed on the printer-not on the TV Screen. If you want to use the Control Key Command sequence to type LLIST, type: [L][CONTROL][6] and the Screen will display LLIST Note that if you try to LLIST a program when you do not have a printer connected to the MC-10, you will "hang-up" the Computer. The only thing you can do then is press the RESET Button (on the back of the Computer).

Comments should be directed to the following email address:
dsbrain@neosplice.com